<template>
  <div>
    <el-table
      :data="data"
      :border="true"
      :header-cell-class-name="$style.tableHeaderCell"
      v-loading="loading"
      tooltip-effect="dark"
      style="width: 100%"
      ref="taskLogTable"
    >
      <el-table-column align="center" min-width="150px" prop="id" label="任务ID"></el-table-column>
      <el-table-column align="center" min-width="100px" prop="topChannelName" label="顶级渠道"></el-table-column>
      <el-table-column align="center" min-width="90px" prop="channelCode" label="渠道编号"></el-table-column>
      <el-table-column align="center" min-width="90px" prop="goodsNum" label="商品数量"></el-table-column>
      <el-table-column align="center" min-width="80px" prop="successNum" label="成功"></el-table-column>
      <el-table-column align="center" min-width="80px" prop="failureNum" label="失败"></el-table-column>
      <el-table-column align="center" min-width="80px" prop="status" label="状态">
        <template slot-scope="scope">
          <div v-if="scope.row.status === 'SUCCESS'" style="color: #13ce66">
            处理成功
          </div>
          <div v-if="scope.row.status === 'FAILURE'" style="color:red">
            处理失败
          </div>
          <div v-if="scope.row.status === 'INIT'" style="color: #b3d8ff">
            待处理
          </div>
          <div v-if="scope.row.status === 'PROCESSED'" style="color: aquamarine">
            处理中
          </div>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="150px" prop="storeLevel" label="操作人">
        <template slot-scope="scope">
          <div>{{ scope.row.creator }}（{{ scope.row.creatorNumber }}）</div>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="150px" prop="createTime" label="创建时间"></el-table-column>
      <el-table-column align="center" min-width="150px" prop="lastModify" label="修改时间"></el-table-column>
      <el-table-column align="center" min-width="150px" prop="createTime" label="操作">
        <template slot-scope="scope">
          <span style="color: #409eff;cursor: pointer;" @click="rollBack(scope.row)">重新执行</span>
          <span style="color: #409eff;cursor: pointer;margin-left: 15px" v-if="scope.row.failureNum > 0" @click="downloadError(scope.row)"
            >下载错误文件</span
          >
        </template>
      </el-table-column>
    </el-table>
    <div :class="$style.tablePagination">
      <el-pagination
        @size-change="onPageSizeChange"
        @current-change="onPageNumChange"
        :current-page="currentPage"
        :page-sizes="[10, 15, 20, 50]"
        :page-size="pageSize"
        layout="total, prev, pager, next, sizes"
        :total="total"
      />
    </div>
  </div>
</template>
<style lang="scss" module>
@import './index.module.scss';
</style>

<script>
import Index from './index';
export default Index;
</script>
